Skip to content
This repository has been archived by the owner on Mar 9, 2018. It is now read-only.

Replace Hash#to_json and ActiveSupport::JSON to MultiJson #48

Merged
merged 1 commit into from Jun 20, 2012

Conversation

bongole
Copy link
Contributor

@bongole bongole commented Jun 20, 2012

To be able to select more fast and more space-saving JSON engine.

Space-saving is important for non-ascii utf8 string.
See the following examples.

  • ActiveSupport::JSON
    ActiveSupport::JSON.encode( { "aps" => { "alert" => "あいうえお" } } ) #=> {"aps":{"alert":"\u3042\u3044\u3046\u3048\u304a"}} # 50 bytes
  • MultiJSON with oj engine
    MultiJson.dump( { "aps" => { "alert" => "あいうえお" } ) #=> {"aps":{"alert":"あいうえお"}} # 35 bytes

ileitch added a commit that referenced this pull request Jun 20, 2012
Replace Hash#to_json and ActiveSupport::JSON to MultiJson
@ileitch ileitch merged commit cc3b460 into ileitch:master Jun 20, 2012
@ileitch
Copy link
Owner

ileitch commented Jun 20, 2012

Thank you.

@ileitch
Copy link
Owner

ileitch commented Jun 20, 2012

This is failing on REE: http://travis-ci.org/#!/ileitch/rapns/jobs/1666415

Any idea why?

@bongole
Copy link
Contributor Author

bongole commented Jun 21, 2012

Because of ok_json, MultiJson's default JSON engine, converting ActiveSupport::OrderedHash into Hash in internal.
To resolve the failure add 'gem "yajl-ruby"' to Gemfile .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants